package com.matt.domain.record;

import com.matt.commons.model.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/8/3
 * *******************************
 */
@Data
@Entity
@Table(name = "live_record")
@EqualsAndHashCode(callSuper = true)
public class LiveRecord extends Domain {

    @Column(columnDefinition = " varchar(50) COMMENT '题目' ")
    private String title;

    @Column(columnDefinition = " varchar(1024) COMMENT '内容' ")
    private String content;

    @Column(columnDefinition = " int default 0 COMMENT '类型 1：托班观测记录 2：早教观测记录，3园区动态' ")
    private Integer category=0;

    @Column(columnDefinition = " int default 0 COMMENT '媒体文件类型 1：图片，2：视频' ")
    private Integer mediaType=0;

    @Column(columnDefinition = " varchar(2048) COMMENT '媒体文件地址' ")
    private String resourceUrl;

    @Column(columnDefinition = " varchar(1024) COMMENT '预览图地址' ")
    private String thumbUrl;

    @Column(columnDefinition = " varchar(32) COMMENT '上传人id' ")
    private String operatorId;

    @Column(columnDefinition = " varchar(50) COMMENT '上传人姓名' ")
    private String operatorName;

    @Column(columnDefinition = " varchar(32) COMMENT '对应园区id' ")
    private String areaId;

    @Column(columnDefinition = " varchar(32) COMMENT '对应课程id' ")
    private String coursePlanId;


    @Column(columnDefinition = "varchar(100) COMMENT '头像'")
    private String headImgUrl = "";


    public static LiveRecord of(String title, String content, Integer category, String resourceUrl, String thumbUrl, String operatorId, String operatorName, String areaId, Integer mediaType, String coursePlanId,String headImgUrl) {
        LiveRecord liveRecord = new LiveRecord();
        liveRecord.setTitle(title);
        liveRecord.setContent(content);
        liveRecord.setCategory(category);
        liveRecord.setResourceUrl(resourceUrl);
        liveRecord.setThumbUrl(thumbUrl);
        liveRecord.setOperatorId(operatorId);
        liveRecord.setOperatorName(operatorName);
        liveRecord.setAreaId(areaId);
        liveRecord.setMediaType(mediaType);
        liveRecord.setCoursePlanId(coursePlanId);
        liveRecord.setHeadImgUrl(headImgUrl);
        return liveRecord;
    }
}
